package cn.micai.base.io;

import java.io.File;

/**
 * 描述：How to rename a file in java
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/6/7 14:25
 */
public class RenameFileMain {

    public static void main(String [] args) {

        System.out.println("--------------------");

        // Read the file
        File configFile = new File("src/main/resources/config.properties");

        // destination file object
        File configFileNew = new File("src/main/resources/config_new.properties");
        boolean renameSuccess = configFile.renameTo(configFileNew);

        if (renameSuccess) {
            System.out.println("Rename operation is successful");
        } else {
            System.out.println("Rename operation is unsuccessful");
        }

        System.out.println("--------------------");

    }
}
